import request from '@/utils/request'
import qs from 'qs'
export function login(data) {
  return request({
    url: '/soker/sys/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/soker/sys/logout',
    method: 'post'
  })
}

export function getUserList() {
  return request({
    url: '/soker/auth-admin/list',
    method: 'GET'
  })
}

// 添加用户
export function addUser() {
  return request({
    url: '/soker/auth-admin/save',
    method: 'POST'
  })
}

// 删除用户
export function deleteUser() {
  return request({
    url: '/soker/auth-admin/delete',
    method: 'POST'
  })
}

// 获取角色列表
export function getRoleList() {
  return request({
    url: '/soker/sys/role/list',
    method: 'GET'
  })
}

// 添加角色
export function addRole(data) {
  return request({
    url: '/soker/sys/role/save',
    method: 'POST',
    data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/soker/sys/role/update',
    method: 'POST',
    data
  })
}


// 删除角色
export function deleteRole(data) {
  return request({
    url: '/soker/sys/role/delete/' + data,
    method: 'POST'
  })
}


// 添加菜单
export function addMenu(data) {
   var readyData = qs.stringify(data)
  return request({
    url: '/soker/sys/menu/save',
    method: 'POST',
    data
  })
}

// 修改菜单
export function updateMenu(data) {
   var readyData = qs.stringify(data)
  return request({
    url: '/soker/sys/menu/update',
    method: 'POST',
    data
  })
}

// 菜单删除
export function deleteMenu(data) {
  return request({
    url: '/soker/sys/menu/delete/' + data,
    method: 'POST'
  })
}

// 菜单列表
export function menuList() {
  return request({
    url: '/soker/sys/menu/list',
    method: 'GET'
  })
}
